﻿Public Class AddRemoveTable_Page
    Public Sub Initialize()
        TextBoxTableId.Text = ""
        TextBoxCount.Text = ""
        RadioButtonAdd.IsChecked = True
    End Sub

    Private Sub ButtonOK_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles ButtonOK.Click
        Try
            If RadioButtonAdd.IsChecked Then
                SysManage.tablemanage(Convert.ToInt32(TextBoxTableId.Text), Convert.ToInt32(TextBoxCount.Text))
                MsgBox("添加成功!")
            Else
                SysManage.tablemanage(Convert.ToInt32(TextBoxTableId.Text))
                MsgBox("删除成功!")
            End If
        Catch err As Exception
            MsgBox(err.Message)
        End Try
    End Sub

    Private Sub ButtonReSet_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles ButtonReSet.Click
        Initialize()
    End Sub

    Private Sub AddRemoveTable_Page_KeyDown(sender As Object, e As System.Windows.Input.KeyEventArgs) Handles Me.KeyDown
        If e.Key = Key.Return Then ButtonOK_Click(sender, New RoutedEventArgs)
    End Sub
End Class
